package com.weihj;

import com.weihj.User;
import com.weihj.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by weihuajiang on 2017/7/3.
 */

@RestController
@RequestMapping("/users")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/search", method = RequestMethod.GET)
    String test() {
        List<User> userList = userService.getUsers();
        return "";
    }

    @RequestMapping(value = "/add", method = RequestMethod.GET)
    String add() {
        User user = new User("1", "whj", "22");
        if (userService.addUser(user)) {
            return "1";
        }
        return "0";
    }
}
